package org.micropayment.provider.oauth.service;

import org.micropayment.model.service.MicropaymentConsumerDAO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth.common.OAuthException;
import org.springframework.security.oauth.provider.ConsumerDetails;
import org.springframework.security.oauth.provider.ConsumerDetailsService;
import org.springframework.stereotype.Service;

/**
 *
 * @author jj
 */
@Service("consumerDetails")
public class MicropaymentConsumerDetailsService implements ConsumerDetailsService {

    private static Logger logger =
            LoggerFactory.getLogger(MicropaymentConsumerDetailsService.class);

    @Autowired MicropaymentConsumerDAO consumerDao;

    public ConsumerDetails loadConsumerByConsumerKey(String consumerKey)
            throws OAuthException {
        return consumerDao.findByConsumerKey(consumerKey);
    }

}